<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
	<script>var ctx="${ctx}";</script>
	<head>
	    <meta charset="utf-8">
	    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	    <title>管理平台</title>
	    <meta name="keywords" content="体验,友好,高级管理台,易用,高性能,高扩展性,bootstrap框架,响应式后台">
	    <meta name="description" content="这是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">
	    <meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
		<meta http-equiv="expires" content="Wed, 26 Feb 209908:21:57 GMT"> 
	    <!--[if lt IE 8]>
	    <meta http-equiv="refresh" content="0;ie.html" />
	    <![endif]-->
	    <link rel="shortcut icon" href="favicon.ico"> 
		<link href="${ctx}/static/css/bootstrap.min.css?v=${static_version}" rel="stylesheet">
		<link href="${ctx}/static/css/font-awesome.min.css?v=4.4.0?v=${static_version}" rel="stylesheet">
		<link href="${ctx}/static/css/plugins/footable/footable.core.css?v=${static_version}" rel="stylesheet">
		<link href="${ctx}/static/css/plugins/summernote/summernote.css?v=${static_version}" rel="stylesheet">
		<link href="${ctx}/static/css/plugins/summernote/summernote-bs3.css?v=${static_version}" rel="stylesheet">
		<link href="${ctx}/static/plugins/laypage/laypage.css?v=${static_version}"  rel="stylesheet">
		<link href="${ctx}/static/css/plugins/chosen/chosen.css?v=${static_version}" rel="stylesheet">
		<link href="${ctx}/static/css/animate.min.css?v=${static_version}" rel="stylesheet">
		<link href="${ctx}/static/js/plugins/layer/laydate/laydate.css?v=${static_version}" rel="stylesheet">
		<link href="${ctx}/static/css/plugins/webuploader/webuploader.css?v=${static_version}" rel="stylesheet">
		<link href="${ctx}/static/css/style.min.css?v=4.0.0" rel="stylesheet">
	    
	</head>
	<body>
		<table data-userid="${userId}" id="sysUser_role_table2" data-page-size="8" data-action="${ctx}/role/findUserRole?userId=${userId}" 
		data-datatable="true"  class="footable table">
		  	<thead>
			  	<tr>
			  		<th  data-ignore="true" data-hide="all" data-title ="id" >id</th>
			  		<th  data-sort-ignore="true" data-title ="check"  data-type="callback" data-callback="checkFormat">登录用户名</th>
			  		<th  data-sort-ignore="true" data-title ="name" data-toggle="true">角色名称</th>
					<th  data-sort-ignore="true" data-title ="createUser" >生成人</th>
			  	</tr>
		  	</thead>
		  	<tbody>
		  	</tbody>
	  	</table>
		
	<script src="${ctx}/static/js/jquery.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/bootstrap.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/footable/footable.all.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/validate/jquery.validate.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/validate/messages_zh.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/webuploader/webuploader.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/summernote/summernote.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/summernote/summernote-zh-CN.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/chosen/chosen.jquery.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/layer/laydate/laydate.js?v=${static_version}"></script>
	<script src="${ctx}/static/plugins/laypage/laypage.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/eModal.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/cookie.js?v=?v=${static_version}""></script>
	<script src="${ctx}/static/common/custom-table.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/content.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/contabs.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/common/common.js?v=${static_version}"></script>
	
	<script>
	
		var checkFormat=function(data, type, full){
			if(data){
				return '<input type="checkbox" checked="checked">'
			}
			return '<input type="checkbox">'
		}
		
		$(document).ready(function() {
			init_page_table("#sysUser_role_table2",function(){
				$('input:checkbox').click(function() {
					var roleId=$(this).parent().prev().text();
					var isAdd=false;
					if($(this).is(':checked')) {
						isAdd=true;
					}
					$.ajax({  
   	 					url:'${ctx}/role/updateUserRole',  
   	 					data:{
   	 						roleId:roleId,							
   	 						userId:$("#sysUser_role_table2").data("userid"),
   	 						isAdd:isAdd	
						},   
						type: 'POST',
   	 					dataType:'json',  
   	 					success:function(response){
   	 						if(response.code==0){
   	 						}else{
   	 						    $.confirm({cancelButton: "关   闭",title: '提示!',content: (me).data("title")+"错误!"||"保存数据错误!"});
   	 						}
   	 					}  
   	 			    }); 
				});
			});
		});
		
	</script>
	
	</body>
</html>